//
//  AppDelegate.m
//  <8>Archiving
//
//  Created by chen on 16/9/8.
//  Copyright © 2016年 tyrad. All rights reserved.
//

#import "AppDelegate.h"
#import "Dog.h" 

@interface AppDelegate ()

@property (weak) IBOutlet NSWindow *window;
@end

@implementation AppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
 
    Dog *dog = [[Dog alloc]init];
  
    NSString *filePath = @"/Users/tyrad/Desktop/ABC.data" ;
    
    BOOL ret = [NSKeyedArchiver archiveRootObject:dog toFile: filePath];
    
    NSLog(@"成功否? %d",ret);
    
    Dog *retDog = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath];
    
    NSLog(@"%@", retDog.name);
    

}

- (void)applicationWillTerminate:(NSNotification *)aNotification {
    // Insert code here to tear down your application
}

@end
